mirror your GitHub repos to tangled.org automatically
1

Configure Feed

Select the types of activity you want to include in your feed.

1import { and, eq } from 'drizzle-orm' 2import { repoMapping } from '~~/server/db/schema' 3import { useDb } from '~~/server/utils/db' 4import { requireSession } from '~~/server/utils/server-session' 5 6/** Clear `disabledAt`, resuming sync for this mapping. */ 7export default defineEventHandler(async event => { 8 const session = await requireSession(event) 9 const mappingId = Number(getRouterParam(event, 'id')) 10 if (!Number.isFinite(mappingId)) { 11 throw createError({ statusCode: 400, statusMessage: 'invalid mapping id' }) 12 } 13 14 const db = useDb() 15 const updated = await db.update(repoMapping) 16 .set({ disabledAt: null, updatedAt: new Date() }) 17 .where(and( 18 eq(repoMapping.id, mappingId), 19 eq(repoMapping.installationId, session.installationId), 20 )) 21 .returning({ id: repoMapping.id }) 22 if (updated.length === 0) { 23 throw createError({ statusCode: 404, statusMessage: 'mapping not found' }) 24 } 25 return { ok: true } 26})